/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package javautil.collections;

/**
 *
 * @author stewari1
 */
public class DimensionCheck {

    public static boolean isSameDimen(int[]... arrays) {

        boolean result = true;
        int dimen      = arrays[0].length;

        for (int i = 1; i < arrays.length; i++) {

            if (dimen != arrays[i].length) {

                result = false;

                break;
            }
        }

        return result;
    }

    /**
     * same as checking by @link ArrayUtil#isRagged(). Only advantage is it allows for comma seperated entries
     * as well as arrays. The other one only allows for arrays.
     * @param arrays
     * @return
     */
    public static boolean isSameDimen(int[][]... arrays) {

        for (int[][] array : arrays) {

            if (!isSameDimen(array)) return false;
        }

        return true;
    }
}
